package com.example.lenovo.weiyi;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import share.HttpIP;

public class LunBoXQActivity extends BaseActivity {

    @BindView(R.id.tv_lunbo_title)
    TextView tvLunboTitle;
    @BindView(R.id.tv_lunbo_time)
    TextView tvLunboTime;
    @BindView(R.id.web_lunbo)
    WebView webLunbo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lun_bo_xq);
        ButterKnife.bind(this);
        ChangLayTitle("");
        LayBack();
        init();
    }

    public void init() {
        tvLunboTitle.setText(getIntent().getStringExtra("title"));
        tvLunboTime.setVisibility(View.GONE);
        String str_canshu = "<!doctype html><html>\n<meta charset=\"utf-8\"><style type=\"text/css\">body{padding:0; margin:0;}\n." +
                "view_h1{ width:90%%;display:block; "
                + "overflow:hidden; margin:0 auto; font-size:1.2em; color:#333; padding:1em 0;"
                + " line-height:1.2em; text-align:center;}\n.view_time{ width:90%; display:block; "
                + "text-align:center;overflow:hidden; margin:0 auto; font-size:1em; color:#999;}\n.con{width:90%; "
                + "margin:0 auto; color:#fff; color:#333; padding:0.5em 0; overflow:hidden; display:block; font-size:0.92em;"
                + " line-height:1.8em;}\n.con h1,h2,h3,h4,h5,h6{ font-size:1em;}\n .con img{width: auto; max-width: 100%;"
                + "height: auto;margin:0 auto;}\n</style>\n<body style=\"padding:0; margin:0; \"><div class=\"con\">"
                + getIntent().getStringExtra("content") + "</div></body></html>";
        webLunbo.getSettings().setJavaScriptEnabled(true); //设置支持Javascript
        webLunbo.loadDataWithBaseURL(HttpIP.Base_IpIMage
                , str_canshu, "text/html", "UTF-8", null);
    }
}
